home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / f90 / pxfgetenv.z / pxfgetenv
Encoding:
Text File  |  2002-10-03  |  5.7 KB  |  118 lines

  1. PXFGETENV(3F)                                         Last changed: 1-22-99
  2.  
  3.  
  4. NNAAMMEE
  5.      PPXXFFGGEETTEENNVV - Returns a value for the environment name
  6.  
  7. SSYYNNOOPPSSIISS
  8.      SSUUBBRROOUUTTIINNEE PPXXFFGGEETTEENNVV ((_n_a_m_e,, _l_e_n_n_a_m_e,, _v_a_l_u_e,, _l_e_n_v_a_l,, _i_e_r_r_o_r))
  9.      CCHHAARRAACCTTEERR**_n _n_a_m_e,, _v_a_l_u_e
  10.      IINNTTEEGGEERR _l_e_n_n_a_m_e,, _l_e_n_v_a_l,, _i_e_r_r_o_r
  11.  
  12. IIMMPPLLEEMMEENNTTAATTIIOONN
  13.      UNICOS, UNICOS/mk, and IRIX systems
  14.  
  15. DDEESSCCRRIIPPTTIIOONN
  16.      On IRIX systems, this routine is in lliibbffoorrttrraann..ssoo which is linked by
  17.      default when compiling programs with the MIPSpro 7 Fortran 90 compiler
  18.      or when compiling programs with the --ccrraayylliibbss option to the MIPSpro
  19.      F77 compiler.
  20.  
  21.      The PPXXFFGGEETTEENNVV subroutine uses the ggeetteennvv() function to search the
  22.      environment list for a _n_a_m_e in a string of the form _n_a_m_e=_v_a_l_u_e.
  23.  
  24.      If _n_a_m_e matches a name in the list, the character representation of
  25.      _v_a_l_u_e is stored in the _v_a_l_u_e character argument and the number of
  26.      characters in _v_a_l_u_e is stored in _l_e_n_v_a_l.  If the length of the value
  27.      to be placed in _v_a_l_u_e is larger than the declared length of _v_a_l_u_e, the
  28.      value string is truncated on the right and stored in _v_a_l_u_e.  The
  29.      nontruncated length is stored in _l_e_n_v_a_l and _i_e_r_r_o_r is set to eettrruunncc.
  30.      If the length of the value is shorter than the declared size of _v_a_l_u_e,
  31.      the value string is stored with left justification and filled with
  32.      blanks on the right.  _l_e_n_v_a_l is set to the shorter length of the value
  33.      string.
  34.  
  35.      If _n_a_m_e is found but has no value, blanks are stored in _v_a_l_u_e and
  36.      _l_e_n_v_a_l is set to zero.  If _n_a_m_e cannot be found, EEIINNVVAALL is returned in
  37.      _i_e_r_r_o_r.
  38.  
  39.      When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on
  40.      UNICOS, UNICOS/mk, or IRIX systems, all arguments must be of default
  41.      kind unless documented otherwise.  On UNICOS and UNICOS/mk, default
  42.      kind is KKIINNDD==88 for integer, real, complex, and logical arguments; on
  43.      IRIX, the default kind is KKIINNDD==44.
  44.  
  45.      The following is a list of valid arguments for this routine:
  46.  
  47.      _n_a_m_e      An input character variable or array element containing the
  48.                name of an environment variable.
  49.  
  50.      _l_e_n_n_a_m_e   An input integer variable containing the length of _n_a_m_e in
  51.                characters.  If _l_e_n_n_a_m_e is zero, the trailing blanks are
  52.                removed.  The declared length of the input name is
  53.                decremented by the number of blanks removed.  If _l_e_n_n_a_m_e is
  54.                zero and _n_a_m_e is all blanks, the input name is a null
  55.                string.
  56.  
  57.      _v_a_l_u_e     An output character variable or array element containing the
  58.                value of the environment variable _n_a_m_e.
  59.  
  60.      _l_e_n_v_a_l    An output integer variable containing the length of _v_a_l_u_e in
  61.                characters.  If _n_a_m_e is found but has no value, _l_e_n_v_a_l is
  62.                zero and _v_a_l_u_e contains all blanks to indicate a null
  63.                string.  If the value representation is truncated to be
  64.                stored in _v_a_l_u_e, _l_e_n_v_a_l contains the nontruncated length of
  65.                value.  If the value representation is shorter than the
  66.                length of _v_a_l_u_e, _l_e_n_v_a_l contains the shorter length.
  67.  
  68.      _i_e_r_r_o_r    An output integer variable containing the status:
  69.  
  70.                EEIINNVVAALL    If _n_a_m_e is not in the environment list.
  71.  
  72.                EETTRRUUNNCC    If the declared length of _v_a_l_u_e is insufficient to
  73.                          contain the string to be returned.  The value of
  74.                          _n_a_m_e is truncated to fit in _v_a_l_u_e, and _l_e_n_v_a_l
  75.                          contains the original length of the value of _n_a_m_e
  76.                          before truncation.
  77.  
  78.                Zero      ggeetteennvv is successful (if _n_a_m_e is found).
  79.  
  80. EEXXAAMMPPLLEESS
  81.      In this example, PPXXFFGGEETTEENNVV searches for a string containing
  82.      SSHHEELLLL==_v_a_l_u_e.
  83.  
  84.                program testpxf
  85.                character*24 namea, nameb
  86.                integer lena, lenb, ier
  87.           c set input arguments
  88.                ier = 0
  89.                lena=0
  90.                lenb=0
  91.                namea='SHELL'
  92.                nameb=' '
  93.                CALL PXFGETENV (namea, lena, nameb, lenb, ier)
  94.                print *,'TEST results:'
  95.           c print input arguments
  96.                print *,'namea=-',namea,'-'
  97.                print *,'lena=',lena
  98.           c print output arguments
  99.                print *,'nameb=-',nameb,'-'
  100.                print *,'lenb=',lenb
  101.                print *,'ier=',ier
  102.                end
  103.  
  104.      If the string is found, it may return:
  105.  
  106.                TEST results:
  107.                namea=-SHELL
  108.                lena=0
  109.                nameb=-/bin/csh
  110.                lenb=8
  111.                ier=0
  112.  
  113. SSEEEE AALLSSOO
  114.      ggeetteennvv(3C)
  115.  
  116.      _A_p_p_l_i_c_a_t_i_o_n _P_r_o_g_r_a_m_m_e_r'_s _L_i_b_r_a_r_y _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l for the printed
  117.      version of this man page.
  118.